let _counter = 1;

const Counter = {
  increment() {
    return _counter++;
  }
};

export function engRandomMarkers(engType, markerCount) {
  if (markerCount > 0) {
    return new Array(markerCount).fill(true).map(() => {
      const markerId = Counter.increment();
      return {
        position: {
          longitude: 111.286451 + Math.random() / 100,
          latitude: 30.69187 + Math.random() / 100,
        },
        offset: [-16, -16],
        engType: engType,
        markerId: markerId,
        draggable: false,
        icon: engType,
        // title: markerId,
        topWhenClick: true,
        extData: {
          engType: engType,
          markerId: markerId,
          showInfo: false,
          engInfo: {}
        }
      }
    });
  }
}

export function engRandomMarker(engType) {
  const markerId = Counter.increment();
  return {
    position: {
      longitude: 111.286451 + Math.random() / 100,
      latitude: 30.69187 + Math.random() / 100,
    },
    offset: [-16, -16],
    engType: engType,
    markerId: markerId,
    draggable: false,
    icon: engType,
    // title: markerId,
    topWhenClick: true,
    extData: {
      engType: engType,
      markerId: markerId,
      showInfo: false,
      engInfo: {}
    }
  };
}

